package edu.cuit.avatar.method;

public class TestPassByValue {
    public static void swap(int n1, int n2){
        System.out.println("交换前, n1 = " + n1 + "; n2 = " + n2);
        int temp = n1;
        n1 = n2;
        n2 = temp;
        System.out.println("交换后, n1 = " + n1 + "; n2 = " + n2);
    }

    public static void main(String[] args) {
        int num1 = 10;
        int num2 = 20;

        System.out.println("调用交换方法前, num1 = " + num1 + "; num2 = " + num2); // 10, 20
        swap(num1, num2);
        System.out.println("调用交换方法后, num1 = " + num1 + "; num2 = " + num2); // 10, 20
    }
}
